class GroupMemberListResponse {
  List<GroupMemberResponse> rows;
  int total;

  GroupMemberListResponse({
    required this.rows,
    required this.total,
  });

  factory GroupMemberListResponse.fromJson(Map<String, dynamic> json) =>
      GroupMemberListResponse(
        total: json['total'] as int,
        rows: (json['rows'] as List)
            .map((e) => GroupMemberResponse.fromJson(e))
            .toList(),
      );
}

class GroupMemberResponse {
  int? memberId;
  int? customerId;
  String? customerName;
  String? avatar;
  int? followFlag;
  int? grade;
  int officialFlag;
  String? officialName;

  GroupMemberResponse({
    this.memberId,
    this.customerId,
    this.customerName,
    this.avatar,
    this.followFlag,
    this.grade,
    this.officialFlag = 0,
    this.officialName,
  });

  factory GroupMemberResponse.fromJson(Map<String, dynamic> json) {
    return GroupMemberResponse(
      memberId: json['memberId'] as int?,
      customerId: json['customerId'] as int?,
      customerName: json['customerName'] as String?,
      avatar: json['avatar'] as String?,
      followFlag: json['followFlag'] as int?,
      grade: int.tryParse((json['grade'] as String?) ?? ''),
      officialFlag: (json['officialFlag'] as int?) ?? 0,
      officialName: json['officialName'] as String?,
    );
  }

  Map<String, dynamic> toJson() => {
        'memberId': memberId,
        'customerId': customerId,
        'customerName': customerName,
        'avatar': avatar,
        'followFlag': followFlag,
        'grade': grade,
        'officialFlag': officialFlag,
        'officialName': officialName,
      };
}
